@extends('layouts.backend')
@section('title')
    添加后台菜单
@endsection

@section('body')
    <div class="row">
        <div class="ibox">
            <div class="ibox-title">
                <h5>添加后台菜单</h5>
                <a href="{{route('backend.menu.index')}}" class="btn btn-primary pull-right">返回列表</a>
                <div class="clearfix"></div>
            </div>
            <div class="ibox-content">
                <div class="row ">
                    <div class="col-md-8">
                        <form method="post" class="form-horizontal" >
                            @csrf
                            <div class="form-group">
                                <label >父菜单@include('components.backend.required')</label>
                                <select name="parent_id" class="form-control">
                                    <option value="0">顶级菜单</option>
                                    @foreach($menus as $menu)
                                        <option value="{{$menu->id}}">{{$menu->name}}</option>
                                        {{--@foreach($menu->children as $child)--}}
                                            {{--<option value="{{$child->id}}" disabled="disabled">|----{{$child->name}}</option>--}}
                                        {{--@endforeach--}}
                                    @endforeach
                                </select>
                            </div>
                            <div class="form-group">
                                <label >排序 @include('components.backend.required')</label>
                                <input type="text" name="order" class="form-control" placeholder="排序" value="" required>
                            </div>
                            <div class="form-group">
                                <label>菜单名称 @include('components.backend.required')</label>
                                <input type="text" name="name" class="form-control" placeholder="菜单名称" value="" required>
                            </div>
                            <div class="form-group">
                                <label>链接地址 @include('components.backend.required')</label>
                                <input type="text" name="url" class="form-control" placeholder="链接地址" value="" required>
                            </div>
                            <div class="form-group">
                                <label>关联权限 @include('components.backend.required')</label>
                                <select name="permission_name" class="form-control">
                                    <option value="0">无</option>
                                    @foreach($permissions as $permission)
                                        <option value="{{ $permission->name }}">{{ $permission->display_name }}</option>
                                    @endforeach
                                </select>
                            </div>

                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2 pull-right">
                                    <button class="btn btn-primary" type="submit">添加</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>

            </div>
        </div>
    </div>
@endsection
